﻿using System;
using System.ComponentModel;

namespace SharpShare.Afp.Protocol.Security {
    [DisplayName("None")]
    [Description("This UAM attempts to log in as Guest.")]
    public class AfpNoUserAuthenticationMethod : IAfpUserAuthenticationMethod {
        public string Name {
            get { return AfpUams.kNoUserAuthStr; }
        }

        public AfpUserAuthenticationResult Authenticate(IAfpSession session, string version, string path, string username, AfpStream authInfoStream) {
            IShareService shareServer = (IShareService)session.Server;

            IAfpUser user = session.Server.UserManager.GetUser("Guest");

            if (user == null)
                return new AfpDenyUserAuthenticationResult();
        
            return new AfpAllowUserAuthenticationResult(version, this.Name, user);
        }

        public AfpUserAuthenticationResult ContinueAuthentication(IAfpSession session, short id, AfpStream authInfoStream) {
            throw new NotImplementedException();
        }
    }
}
